<template>
    <div>
      <el-dropdown trigger="click">
      <span class="el-dropdown-link user_name" v-if="$store.getters.userInfo">
        {{$store.getters.userInfo.name}}<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item icon="el-icon-edit" @click.native="updateHeader">修改</el-dropdown-item>
          <el-dropdown-item icon="el-icon-edit" @click.native="loginOut">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
</template>

<script>
  import Cookies from "js-cookie"
    export default {
      name: "userComm",
      data(){
        return{
          dialogTitle:'修改个人信息',
          dialogForm:false,
        }
      },
      methods:{
        loginOut(){
          Cookies.remove("token");
          this.$router.push({path:'/login'});
          location.reload()
        },
        /*
        * 修改个人信息
        * */
        updateHeader(){
          this.dialogForm = true;
        },
      },
      mounted() {
      }
    }
</script>

<style scoped>
  .user_name{
    cursor:pointer
  }
</style>
